/**
 *
 * Copyright by Samuel Castro & Joaquim Fonseca, 2011
 * All Rights Reserved
 *
 * NOTES:
 * Please do not redistribute this plugin without my permission
 * Plugin made for private use only
 *
 */
package com.SyDeck.sdCities;

import org.bukkit.event.server.PluginEnableEvent;
import org.bukkit.event.server.ServerListener;

import com.nijiko.coelho.iConomy.iConomy;
import org.bukkit.plugin.Plugin;

/**
 * Checks for plugins whenever one is enabled
 */
public class PluginListener extends ServerListener {

    public PluginListener() {
    }

    @Override
    public void onPluginEnable(PluginEnableEvent event) {
        if (Main.getiConomy() == null) {
            Plugin iConomy = Main.getBukkitServer().getPluginManager().getPlugin("iConomy");

            if (iConomy != null) {
                if (iConomy.isEnabled()) {
                    Main.setiConomy((iConomy) iConomy);
                    System.out.println("[(Plugin)] Successfully linked with iConomy.");
                }
            }
        }
    }
}
